classes = [
    {"name": "abyss", "age": 25, "grade": "A"},
    {"name": "kin", "age": 23, "grade": "B"},
    {"name": "tian", "age": 24, "grade": "B"},
    {"name": "hun", "age": 26, "grade": "A"},
    {"name": "exe", "age": 21, "grade": "A"}
]
#匿名函数排序
classes1 = classes
classes1.sort(key=lambda x: x["age"])
print(classes1)

#常规函数排序
classes2 = classes
def sy(x):
    return x["age"]
classes2.sort(key=sy)
print(classes2)

#增加年龄，并且返回年龄增加后的列表
classes3 = classes
def ssy(x):
    x["age"] +=1
    return x
cc = map(ssy, classes3)
print(classes3)

#用filter过滤成绩为A的同学，输出结果为成绩不为A的同学
classes4 = classes
f = filter(lambda x: x["grade"]!="A", classes4)
print(list(f))

#斐波那契数列用递归函数表示
def fc1(n):
    if n==1:
        return 0
    elif n==2 or n==3:
        return 1
    else:
        return fc1(n-2)+fc1(n-1)
print(fc1(1))